<script setup>
import { inject, ref } from 'vue';
defineProps(['title','age'])
let emit = defineEmits(['update:age'])//事件声明
function fn(){
    emit('update:age',21);
}
let data = ref(10)
function setData(x){
    data.value = x;
}
defineExpose({setData})
let y = inject('name')
</script>


<template>
<div class="box">
    <button @click="fn">点击</button>
{{ title }}-{{ age }}-{{ data }}-{{ y }}
</div>
</template>

<style scoped>

</style>